<?php
require_once("lib/db_connection.php");
$job_id = $_GET['job_id'];
$company_id = $_SESSION['company_id'];

$result_select = mysql_query("SELECT * FROM rou_job_loc_tbl WHERE job_id='".$job_id."'")
or die("SELECT LOCS ".mysql_error());

$result_num = mysql_query("SELECT * FROM route_tbl WHERE route_id='".$job_id."'")
or die("SELECT NUM ".mysql_error());
$row_num = mysql_fetch_array($result_num);

$emp_id = $row_num['emp_id'];
$result_emp = mysql_query("SELECT * FROM employee_tbl WHERE autoid='".$emp_id."'")
or die("SELECT EMP ".mysql_error());
$row_emp = mysql_fetch_array($result_emp);

$result_comp = mysql_query("SELECT company_name FROM company_tbl WHERE company_id='".$company_id."'")
or die("SELECT COMPANY ".mysql_error());
$row_comp = mysql_fetch_array($result_comp);
?>
<html>
<head>
<script type="text/javascript">
function print_doc()
{
window.print();
}
</script>
</head>
<body onload='print_doc()'>
<table border='1' width='810'>
<tr>
 <th colspan='7' style='text-align:center;'><?php echo $row_comp['company_name']?></th>
</tr>
<tr>
 <td colspan='7' style='text-align:left;'><b>Driver:</b> <?php echo $row_emp['lname'].','.$row_emp['fname']?>
 <br><b>Vehicle:</b> <?php echo $row_num['vehicle']?></td>
</tr>
<tr>
 <th width='10%' rowspan='2'>DATE</th>
 <th width='40%' rowspan='2'>CLIENT NAME</th>
 <th width='35%' rowspan='2'>LOCATION</th>
 <th width='30%' colspan='2'>TIME</th>
 <th width='15%' rowspan='2'>ODOMETER</th>
 <th width='10%' rowspan='2'>SIGNATURE</th>
</tr>
<tr>
 <th width='15%'>DEPARTURE</th>
 <th width='15%'>ARRIVAL</th>
</tr>
<?php
while($row_select = mysql_fetch_array($result_select))
{
?>
<tr>
 <td width='10%'>&nbsp;</td>
 <td width='40%'><?php echo $row_select['client']?></td>
 <td width='35%'><?php echo $row_select['location']?></td>
 <td width='15%'>&nbsp;</td>
 <td width='15%'>&nbsp;</td>
 <td width='15%'>&nbsp;</td>
 <td width='10%'>&nbsp;</td>
</tr>
<?php
}
?>
<p style=" position: absolute; bottom: 0; left: 0; width: 100%; text-align: center;"><b><i>Please ask client to sign.<i/><b/></p>
</body>
</html>
<?php
?>